/* TinyOLED - a small library for OLED 0.96
 Copyright (C) 2014 Olivier Gaillard
 All rights reserved. */

#include <Wire.h>
#include <TinyOLED.h>
#include <avr/pgmspace.h>

// 5 battery level 16x8
uint8_t battery [][16] PROGMEM = {
  {0x1c, 0x7f, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x7f},
  {0x1c, 0x7f, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x5d, 0x5d, 0x41, 0x7f},
  {0x1c, 0x7f, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x5d, 0x5d, 0x41, 0x5d, 0x5d, 0x41, 0x7f},
  {0x1c, 0x7f, 0x41, 0x41, 0x41, 0x41, 0x5d, 0x5d, 0x41, 0x5d, 0x5d, 0x41, 0x5d, 0x5d, 0x41, 0x7f},
  {0x1c, 0x7f, 0x41, 0x5d, 0x5d, 0x41, 0x5d, 0x5d, 0x41, 0x5d, 0x5d, 0x41, 0x5d, 0x5d, 0x41, 0x7f}
};

TinyOLED tinyOLED(0x3C); // SPI Address

void setup(){
  tinyOLED.init();  //init OLED display
  tinyOLED.drawStringXY(2,3, "Charging ... "); 
}


void loop(){
  for (byte i = 0; i < 5; i++) {
    tinyOLED.drawBitmap(14, 0, battery[i], 16, 8); // 16x8 pixels
    delay(500);
  }
}
